package com.xmy.cultivate.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xmy.cultivate.entity.StudentFaceData;
import com.xmy.cultivate.mapper.StudentFaceDataMapper;
import com.xmy.cultivate.service.IStudentFaceDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author min
 * @since 2023-01-04
 */
@Service
public class StudentFaceDataServiceImpl extends ServiceImpl<StudentFaceDataMapper, StudentFaceData> implements IStudentFaceDataService {


    @Autowired
    @Lazy
    StudentFaceDataMapper studentFaceDataMapper;

    /**
     * 是否采集
     * @param schoolId
     * @param studentId
     * @return
     */
    public boolean isGather(Long schoolId,Long studentId){

        QueryWrapper<StudentFaceData> studentFaceDataQueryWrapper = new QueryWrapper<>();
        studentFaceDataQueryWrapper.eq("school_id",schoolId);
        studentFaceDataQueryWrapper.eq("student_id",studentId);
        Long count =  studentFaceDataMapper.selectCount(studentFaceDataQueryWrapper);

        if (count.equals(0L)){
            return false;
        }else {
            return true;
        }

    }
}
